<template>
  <div>
    <!-- 双向数据绑定 -->
    <input :value="value" @input="onInput" v-bind="$attrs" />
  </div>
</template>

<script>
export default {
  inheritAttrs: false,
  name: "FInput",
  props: {
    value: {
      type: String,
      defalut: "",
    },
  },
  methods: {
    onInput(e) {
      this.$emit("input", e.target.value);

      // 通知父组件实时校验
      this.$parent.$emit("validate");
    },
  },
};
</script>

<style>
</style>